package services

import (
	"context"
	"datum_user_rpc/dao"
	"datum_user_rpc/models"
	proto "datum_user_rpc/proto"
)

type UserService struct {

}

func (*UserService) GetUserFromUid(ctx context.Context,req *proto.UniRequest,rsp *proto.UniResponse) error{
	var user = models.User{}
	err := dao.Db.First(&user,req.Uid).Error
	if err != nil {
		return err
	}
	rsp.Id = uint32(user.Id)
	rsp.Phone = user.Phone
	rsp.PassWord = user.Password
	rsp.NickName = user.NickName
	rsp.Avatar = user.Avatar
	rsp.CreateTime = user.CreateTime
	return nil
}
